<?php
/**
 * Created by PhpStorm.
 * 各种时间起始点，终点
 * User: ywf
 * Date: 2015/10/21
 * Time: 13:37
 */
$t = time();
$t1 = mktime(0,0,0,date("m",$t),date("d",$t),date("Y",$t)); 
$t2 = mktime(0,0,0,date("m",$t),1,date("Y",$t)); 
$t3 = mktime(0,0,0,date("m",$t)-1,1,date("Y",$t)); 
$t4 = mktime(0,0,0,1,1,date("Y",$t)); 
$e1 = mktime(23,59,59,date("m",$t),date("d",$t),date("Y",$t)); 
$e2 = mktime(23,59,59,date("m",$t),date("t"),date("Y",$t)); 
$e3 = mktime(23,59,59,date("m",$t)-1,date("t",$t3),date("Y",$t)); 
$e4 = mktime(23,59,59,12,31,date("Y",$t)); 
//测试 
echo date("当前 Y-m-d H:i:s",$t)." $t<br>"; 
echo date("今天起点 Y-m-d H:i:s",$t1)." $t1<br>"; 
echo date("今月起点 Y-m-d H:i:s",$t2)." $t2<br>"; 
echo date("上月起点 Y-m-d H:i:s",$t3)." $t3<br>"; 
echo date("今年起点 Y-m-d H:i:s",$t4)." $t4<br>"; 
//测试 
echo date("今天终点 Y-m-d H:i:s",$e1)." $e1<br>"; 
echo date("今月终点 Y-m-d H:i:s",$e2)." $e2<br>"; 
echo date("上月终点 Y-m-d H:i:s",$e3)." $e3<br>"; 
echo date("今年终点 Y-m-d H:i:s",$e4)." $e4<br>"; 